#ifndef NVS_FLASH_H
#define NVS_FLASH_H
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_err.h"
#include "ctrl_data.h"
//用于存储温湿度上下限阈值的存储区
#define TEMP_HUMI_STORAGE "temp_humi_store" 
#define WIFI_STORAGE "wifi_store" 
esp_err_t data2nvs_init(void);
esp_err_t write_data_to_nvs(float max_temp, float min_temp, float max_humi, float min_humi,float low_power) ;
esp_err_t read_data_from_nvs(float *max_temp, float *min_temp, float *max_humi, float *min_humi,float *low_power) ;
esp_err_t write_first_data_boot_flag(bool is_first_boot);
esp_err_t read_first_data_boot_flag(bool *is_first_boot);


esp_err_t write_wifi_info_to_nvs(char *ssid, char *password);
esp_err_t read_wifi_info_from_nvs(char *ssid, char *password);
//删除wifi第一次启动标志位
esp_err_t reset_first_boot_flag();

#endif